package cn.zwx.canal.tools.listener;

import cn.zwx.canal.tools.event.AlterAbstractCanalEvent;
import com.alibaba.fastjson.JSON;
import com.alibaba.otter.canal.protocol.CanalEntry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

/**
 * @description: 只监听修改表名称事件
 * @projectName:learn
 * @see:cn.zwx.canal.tools.listener
 * @author:zhangwenxue
 * @createTime:2021/1/13 13:55
 * @version:1.0
 */
@Component
public class AlterCanalListener  extends AbstractCanalListener<AlterAbstractCanalEvent>{

    private Logger logger = LoggerFactory.getLogger(DeleteCanalListener.class);

    @Override
    protected void doChange(String database, String tableName, CanalEntry.RowData rowData) {
        logger.info("监听到修改字段事件:数据库名称{},表名称:{}",database,tableName);
        System.out.println(JSON.toJSONString(rowData));
    }
}
